var express = require("express");
var router = express.Router();

router.get('/',function(req,res,next){
  res.render('cocos',{activeItemName:'cocos2dx',cocosid:0});
});

router.get('/:id',function(req,res,next){
  var regExp = /^\d+$/;
  if (regExp.test(req.params.id)){
    res.render('cocos',{activeItemName:'cocos2dx',cocosid:req.params.id});
  }
  else{
    next();
  }
});


router.use(function(req,res,next){
  var err = new Error('Not Found');
  err.status = 404;
  next(err);
});
module.exports = router;